/*
 * topological-hex, a program to compute combinatorial hexahedral meshes.
 *
 * Copyright (C) <2018> <Université catholique de Louvain (UCL), Belgique>
 *
 * List of the contributors to the development, description and complete
 * License: see LICENSE file.
 *
 * This program (topological-hex) is free software:
 * you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (see COPYING file).  If not,
 * see <http://www.gnu.org/licenses/>.
 */

#include <check.h>
#include "errors.h"

static void error_callback(const char *message,
                           void *expected) {
  ck_assert_str_eq(message, expected);
}

START_TEST(test_errors) {
  set_error_log_fn(error_callback, "error formated: 42");
  log_error("error formated: %d", 42);
  set_error_log_fn(NULL, NULL);

  log_error("[LOG] other message %d, %d", 53, 27);
} END_TEST

Suite *errors_suite(void) {
  Suite *s = suite_create("Errors");

  TCase *tcase = tcase_create("errors");
  tcase_add_test(tcase, test_errors);
  suite_add_tcase(s, tcase);

  return s;
}
